package palf.visualEffects.transitions {
import flash.display.DisplayObjectContainer;

import palf.visualEffects.VisualEffect;
import palf.visualEffects.layout.Layout;
import palf.visualEffects.timing.Timing;
import palf.visualEffects.utils.PositionData;

public class Transition implements VisualEffect {

	private var layout : Layout;
	private var timing : Timing;

	public function Transition(layout : Layout, timing : Timing) {
		this.layout = layout;
		this.timing = timing;
	}

	public function apply(target : DisplayObjectContainer, offset : int = 0) : void {
		timing.reset();
		var num_children : uint = target.numChildren;
		var data : PositionData;

		for (var i : uint = 0; i < num_children; i++) {
			data = layout.getLayoutData(i - offset, target.getChildAt(i));
			timing.apply(data);
		}
	}

}

}
